Use Nanobot's new config format + model provider dialects#6246
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Obot to integrate Nanobot's new provider dialect system and per-agent provider configuration format. The changes enable Obot to read LLM provider dialects from tool metadata rather than relying on heuristics, and to dynamically configure only the providers actually needed by each agent.
Changes:
- Replaces locally-defined nanobot config structs with imported types from
github.com/nanobot-ai/nanobot/pkg/types - Adds
Dialectfield toCommonProviderMetadatain API types for declaring provider API formats - Introduces per-agent provider configuration via
NANOBOT_PROVIDER_CONFIGdynamic file credential - Adds init containers to inject provider configs into agent workspaces (Docker and Kubernetes)
- Refactors model resolution to capture provider info and dialect for each LLM model
- Updates function names from generic "constructNanobotYAML" to specific "constructMCPServerNanobotYAML" for clarity
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp/backend.go | Replaces local types with nanobot pkg types; consolidates nanobot config construction logic |
| pkg/mcp/docker.go | Adds init container support for provider config injection; refactors repetitive init container code |
| pkg/mcp/kubernetes.go | Adds init container for provider config injection into agent workspaces |
| pkg/controller/handlers/nanobotagent/nanobotagent.go | Refactors model resolution to include provider and dialect info; builds provider-specific config YAML |
| pkg/controller/handlers/nanobotagent/nanobotagent_test.go | Updates tests to work with new resolvedLLMModel return type |
| apiclient/types/modelprovider.go | Adds Dialect field to CommonProviderMetadata |
| go.mod | Updates dependencies and adds local replace directive for nanobot (temporary) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cf926fa to
0dea3fd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
pkg/mcp/docker.go:1
workspaceCreatedis returned astrueeven whenVolumeCreatereturnsAlreadyExists(race with another creator). That defeats the “only run for initial creation” gating and can cause unexpected init behavior. ReturnfalseonAlreadyExists(or re-check existence and setworkspaceCreatedaccordingly) so the boolean accurately reflects whether this call created the volume.
package mcp
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Oh, also, for message policies: right now there is nothing there that would handle chat completions, but it should work with Responses and Anthropic (and OpenResponses if it is identical to Responses). I don't think it necessarily needs to be made to work with chat completions in this same PR, but I wanted to call that out because it is something that will need to get done. |
@g-linville I didn't think we wanted to support chat completions. Maybe I misunderstood |
|
@calvinmclean Oh, I'm not sure if we want to or not. I was assuming that we were because I saw it was one of the dialect types. But if we aren't going to actually support it with any model providers, then yeah we don't need to do it for message policies. |
d692436 to
3cd0a61
Compare
3cd0a61 to
0124b53
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Write .nanobot/nanobot.yaml llmProviders * Simplify docker volume/container inits with runInitContainer * Update some naming to make it clear it is MCP config only * Use Nanobot types when building config * Dynamically build the nanobot.yaml for selected model * Derive Dialect from provider meta * Fix name shadowing * Update go.mod using remote branch * Generate * Fix default proxy for ChatCompletions and add tests * Fix provider config reload with symbolic link * Improve function naming * Improve function naming and other minor changes * Improve ensureCredentials refresh logic * Add Dialect to ModelManifest * regenerate * Always run link for docker * Revert use of nanobottypes * PR comments * Move all config setup to nanobotagent.go * fix boolean condition per copilot comment * Fix error retry check
* Write .nanobot/nanobot.yaml llmProviders * Simplify docker volume/container inits with runInitContainer * Update some naming to make it clear it is MCP config only * Use Nanobot types when building config * Dynamically build the nanobot.yaml for selected model * Derive Dialect from provider meta * Fix name shadowing * Update go.mod using remote branch * Generate * Fix default proxy for ChatCompletions and add tests * Fix provider config reload with symbolic link * Improve function naming * Improve function naming and other minor changes * Improve ensureCredentials refresh logic * Add Dialect to ModelManifest * regenerate * Always run link for docker * Revert use of nanobottypes * PR comments * Move all config setup to nanobotagent.go * fix boolean condition per copilot comment * Fix error retry check
* Write .nanobot/nanobot.yaml llmProviders * Simplify docker volume/container inits with runInitContainer * Update some naming to make it clear it is MCP config only * Use Nanobot types when building config * Dynamically build the nanobot.yaml for selected model * Derive Dialect from provider meta * Fix name shadowing * Update go.mod using remote branch * Generate * Fix default proxy for ChatCompletions and add tests * Fix provider config reload with symbolic link * Improve function naming * Improve function naming and other minor changes * Improve ensureCredentials refresh logic * Add Dialect to ModelManifest * regenerate * Always run link for docker * Revert use of nanobottypes * PR comments * Move all config setup to nanobotagent.go * fix boolean condition per copilot comment * Fix error retry check
* Use Nanobot's new config format + model provider dialects (#6246) * Write .nanobot/nanobot.yaml llmProviders * Simplify docker volume/container inits with runInitContainer * Update some naming to make it clear it is MCP config only * Use Nanobot types when building config * Dynamically build the nanobot.yaml for selected model * Derive Dialect from provider meta * Fix name shadowing * Update go.mod using remote branch * Generate * Fix default proxy for ChatCompletions and add tests * Fix provider config reload with symbolic link * Improve function naming * Improve function naming and other minor changes * Improve ensureCredentials refresh logic * Add Dialect to ModelManifest * regenerate * Always run link for docker * Revert use of nanobottypes * PR comments * Move all config setup to nanobotagent.go * fix boolean condition per copilot comment * Fix error retry check * Add Bifrost provider dialect and enable model providers in UI (#6358) * Add Bifrost provider dialect * Enable bedrock provider in UI * Enable Ollama in UI * Enable Azure, AzureEntra in UI * Update docs * Update Nanobot branch * Improve docs for Azure Entra * fix go mod issue * Resolve PR comments * fix go mod * Improve Ollama networking doc for linux users * Remaining changes: message policies, dependencies, etc. WIP deps Rename NANOBOT_CONFIG_PATH => NANOBOT_CONFIG Fix MessagePolicy for Bifrost Extract and reuse message policies code Include env in BackPopulateModels - This allows the Azure provider to get updated deployments Update kinm + nah improve docs lint generate Improve URL handling * Update pkg/gateway/server/llmproxy.go Co-authored-by: Donnie Adams <donnie@obot.ai> * fix after suggestion applied * Revert "Update pkg/gateway/server/llmproxy.go" This reverts commit 320a47b. * Revert "fix after suggestion applied" This reverts commit 0281a84. * Update Nanobot --------- Co-authored-by: Donnie Adams <donnie@obot.ai>
This PR updates Obot to consume Nanobot's new provider dialect and
llmProvidersconfig format introduced in nanobot-ai/nanobot#263.Addresses #6195
What Changed
Provider dialect support
dialectfield from model provider tool metadata rather than inferring the LLM client type from model nameDialectfield toCommonProviderMetadatain the API typesPer-agent provider config
NANOBOT_PROVIDER_CONFIGas a dynamic file credential injected into nanobot agent containersnanobot.yaml-format provider config containing only the LLM providers actually used by the agent (no more unconditionally injecting bothOPENAI_API_KEYandANTHROPIC_API_KEY).nanobot/nanobot.yamlinside the agent workspace volume via an init container (Docker and Kubernetes)Type consolidation in MCP backend
github.com/nanobot-ai/nanobot/pkg/typesandpkg/mcpDependencies
replacedirective pointing at a local path; will be updated to the released version once that PR is mergeddialectfield in model provider tool definitions (optional)